package com.tencent.iov.cowin.befsale.clue.value.utils;

import com.software.boot.common.util.EmptyUtils;
import com.software.common.config.SearchLocalHeader;
import com.software.common.enums.SCRMRequestHeaderEnum;

/**
 * @Author xiamu
 * @Date 2022/1/3 13:02
 * @Version 1.0
 **/
public class CustomerUtil {
    /**
     * 判断是否是经销商 true 经销商 false 总部客户
     *
     * @return
     */
    public static Boolean isDealer() {
        String dealerId = SearchLocalHeader.getHeader(SCRMRequestHeaderEnum.HEADER_DEALER_ID.getCode());
        if (EmptyUtils.isEmpty(dealerId)) {
            return false;
        }
        return Long.parseLong(dealerId) > 0;
    }

    public static Boolean isDealer(String dealerIdStr) {
        if (EmptyUtils.isEmpty(dealerIdStr)) {
            return false;
        }
        Long dealerId = CommonUtil.getLongByObj(dealerIdStr);
        return !EmptyUtils.isEmpty(dealerId) && dealerId > 0;
    }

    public static Boolean checkCusId(Long cusId) {
        if (EmptyUtils.isEmpty(cusId)) {
            return false;
        }
        return cusId > 0;
    }
}
